package com.example.demo;

import com.example.api.JobExecutor;
import com.fasterxml.jackson.databind.json.JsonMapper;
import org.microhttp.*;

import java.io.IOException;

/**
 * @author fanhang
 */
public class MicrohttpBoot {

    public static void main(String[] args) throws IOException {
        JsonMapper jsonMapper = JsonMapper.builder().build();
        JobExecutor jobExecutor = new JobExecutor();
        Options options = Options.builder().withPort(9090).withConcurrency(4).build();
        Logger logger = new DebugLogger();
        Handler handler = new MicrohttpHandler(jsonMapper, jobExecutor);
        EventLoop eventLoop = new EventLoop(options, logger, handler);
        eventLoop.start();
    }

}
